MRI algorithm